package com.example.demo.util;

import java.util.List;

import com.example.demo.entity.base.ResponseEntity;

/**
 * 
 * @类名 ResponseUtil.java
 * @创建者 xzw
 * @创建日期 2022年4月12日
 * @描述 返回对象创建工厂
 *
 */
public class ResponseFactory {
	
	public static <T> ResponseEntity<T> setObject(T retdata){
		return new ResponseEntity<T>().setObject(retdata);
	}
	
	public static <T> ResponseEntity<T> setList(List<T> listdata){
		return new ResponseEntity<T>().setList(listdata);
	}
	
	public static <T> ResponseEntity<T> setSuccess(T retdata,String msg){
		return new ResponseEntity<T>().setSuccess(retdata, msg);
	}
	
	public static <T> ResponseEntity<T> setSuccess(String msg){
		return new ResponseEntity<T>().setSuccess(msg);
	}
	
	public static <T> ResponseEntity<T> setSuccess(String msg,int code){
		return new ResponseEntity<T>().setSuccess(msg,code);
	}
	
	public static <T> ResponseEntity<T> setFail(String errorMsg,int errorCode){
		return new ResponseEntity<T>().setFail(errorMsg,errorCode);
	}
	
	public static <T> ResponseEntity<T> setFail(int errorCode,String errorMsg,T retdata){
		return new ResponseEntity<T>().setFail(errorCode,errorMsg,retdata);
	}
	
	public static <T> ResponseEntity<T> setFail(int errorCode,String errorMsg,List<T> retlist){
		return new ResponseEntity<T>().setFail(errorCode,errorMsg,retlist);
	}
	
	public static <T> ResponseEntity<T> setFail(String errorMsg){
		return new ResponseEntity<T>().setFail(errorMsg);
	}
	
}
